package com.gz.purchase.library.pojo;

import net.tsz.afinal.annotation.sqlite.Id;
import net.tsz.afinal.annotation.sqlite.Property;
import net.tsz.afinal.annotation.sqlite.Table;

import org.json.JSONException;
import org.json.JSONObject;

/** 账户实体类
 * author wanner1991
 */
@Table(name = "tb_UserInfo")
public class UserInfo {
    @Id
    private int id;
    @Property
    private int user_id ;
    @Property
    private int user_type;// 用户类型：1 配送员 2代购
    @Property
    private String user_name;
    @Property
    private int user_org_id;// 用户所在组织机构
    @Property
    private String name;// 配送员 name值为物业公司 代购员 name值为代购点名称

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public int getUser_type() {
        return user_type;
    }

    public void setUser_type(int user_type) {
        this.user_type = user_type;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public int getUser_org_id() {
        return user_org_id;
    }

    public void setUser_org_id(int user_org_id) {
        this.user_org_id = user_org_id;
    }
    public static UserInfo parse(JSONObject jsonObject) throws JSONException {

        if (jsonObject == null || jsonObject.length() <= 0){
            return  null;
        }
        UserInfo userInfo = new UserInfo();
        userInfo.user_id = jsonObject.getInt("user_id");
        userInfo.user_type = jsonObject.getInt("user_type");
        userInfo.user_name = jsonObject.getString("user_name");
        userInfo.user_org_id = jsonObject.getInt("user_org_id");
        userInfo.name = jsonObject.getString("name");
        return userInfo;


    }

}
